// 通过传过来的歌单id拿到所有歌曲数据
// 支持传递参数limit来限制获取歌曲的数据数量 例如: /playlist/track/all?id=7044354223&limit=10

module.exports = (query, request) => {
  // const data = {
  //   id: query.id,
  //   n: 100000,
  //   s: query.s || 8,
  // }
  // //不放在data里面避免请求带上无用的数据
  // let limit = parseInt(query.limit) || Infinity
  // let offset = parseInt(query.offset) || 0

  // return request('POST', `https://music.163.com/api/v6/playlist/detail`, data, {
  //   crypto: 'api',
  //   cookie: query.cookie,
  //   proxy: query.proxy,
  //   realIP: query.realIP,
  // }).then((res) => {
  //   let trackIds = res.body.playlist.trackIds
  //   let idsData = {
  //     c:
  //       '[' +
  //       trackIds
  //         .slice(offset, offset + limit)
  //         .map((item) => '{"id":' + item.id + '}')
  //         .join(',') +
  //       ']',
  //   }

  //   return request(
  //     'POST',
  //     `https://music.163.com/api/v3/song/detail`,
  //     idsData,
  //     {
  //       crypto: 'weapi',
  //       cookie: query.cookie,
  //       proxy: query.proxy,
  //       realIP: query.realIP,
  //     },
  //   )
  // })
  return new Promise(function(resolve, reject){
    resolve({
      status: 200, // The Http Response Code
      body: {
        "songs": [
          {
              "name": "爱的供养",
              "id": 1,
              "ar": [
                  {
                      "id": 1,
                      "name": "杨幂",
                      "tns": [],
                      "alias": []
                  }
              ],
              "al": {
                  "id": 1,
                  "name": "杨幂",
                  "picUrl": "https://llh-resources-1321535012.cos.ap-guangzhou.myqcloud.com/music/MusicPlaybackCover1.jpg",
                  "tns": [],
                  "pic_str": "109951167325809355",
                  "pic": 1
              },
              "mv": 0,
              "publishTime": 1
          },
          {
            "name": "爱江山更爱美人",
            "id": 2,
            "ar": [
                {
                    "id": 2,
                    "name": "李丽芬",
                    "tns": [],
                    "alias": []
                }
            ],
            "al": {
                "id": 2,
                "name": "李丽芬",
                "picUrl": "https://llh-resources-1321535012.cos.ap-guangzhou.myqcloud.com/music/MusicPlaybackCover2.jpg",
                "tns": [],
                "pic_str": "2",
                "pic": 2
            },
            "mv": 0,
            "publishTime": 2
          }
        
        ]
      }, // API Response body
    cookie: []
    });
  })
}
